<template>
  <div>
    <el-row>
      <el-input
        v-model="searchText.username"
        placeholder="根据用户名搜索"
        size="small"
        style="width: 200px; margin-right: 12px"
      />
      <el-button size="small" @click="clear"> 清空 </el-button>
      <el-button type="primary" size="small" @click="search"> 搜索 </el-button>
    </el-row>
  </div>
</template>

<script>
export default {
  name: 'HeadSearch',
  props: ['searchText'],
  methods: {
    // 清空搜索框
    clear () {
      this.searchText.username = ''
      this.$emit('clear')
    },
    // 搜索
    search () {
      this.$emit('search')
    }
  }
}
</script>

<style scoped lang="less"></style>
